This module is used to work with the CCHR segment files (initial data files).
Exported Classes:
Exported Methods:
Exceptions:
ConvertError
Segment object contains various methods to load, manipulate and save CCHR segment data files.
Public Methods:
load_vars – Loads the CCHR variable set as defined in the metadata.
get_index – Takes a variable name and returns its index.
load_data – Loads the segment data.
convert_vars – Converts the types of all the variables to match the metadata file
get_data – Returns the loaded dataset or None
add_new_vars – Adds derived standardized varaibles to the dataset.
set_length_rules – Sets length rules on all variables in the ds based on metadata file.
assign_var_lengths – Assigns length rules to all the variables.
get_max_length – Returns the highest varaible length in the dataset.
save – Saves the dataset.
Return the variable index of a supplied variable.
Arguments: name – The name of the variable who’s index we want to find. original – Set to True to return the original index
Load the segment data.
If loading delimited data this is assumed to be the original segment data so it is loading using the original variable names. If in_filter was included as an option then will apply the filter variable function.
If limit was included in the options then will limit the rows loaded based on the limit value.
Load variable information from the metadata file.
The variable information in the metadata file contains the full variable set for the segment. This method creates a variable set of the original variable names and stores this in the orig_var_names property.
alias of src.segment